package com.day1012.afternoon;

public class MainText3 {
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread( () ->{
            for (int i = 0; i < 10; i++) {
                System.out.println(i+1);
                try {
                    Thread.sleep(200);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });
        thread.start();
        for (int i = 0; i < 10; i++) {
            if (i==5){
                thread.join();
            }
            System.out.println("你好");
            try {
                Thread.sleep(200);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
